package org.atm.kxp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.atm.kxp.model.Customer;


public class LoginDao {

	/**
	 *
	 * @param c
	 */
	public Customer login(Customer c){
		try {
            ResultSet rs = DbUtil.executeQuery("select * from customer");
            while (rs.next())
                if (rs.getString("cid").equals(c.getCid()) && rs.getString("cpin").equals(c.getCpin()))
                    return new Customer(rs.getString("cid"), rs.getString("cpin"), rs.getString("cname"));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
	}
}//end Login
